package com.ktjy.mapper.user;

import com.sun.xml.internal.bind.v2.runtime.reflect.opt.Const;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class WuBian_5 {
    public static void main(String[] args) {
        try {
            Class clz=Class.forName("com.ktjy.mapper.user.Employee");
            Constructor con=clz.getDeclaredConstructor();
            Object o=con.newInstance();

            Field empNo=clz.getDeclaredField("empNo");
            Field empName=clz.getDeclaredField("empName");
            Field empPost=clz.getDeclaredField("empPost");
            Field empSalary=clz.getDeclaredField("empSalary");

            empNo.setAccessible(true);
            empName.setAccessible(true);
            empPost.setAccessible(true);
            empSalary.setAccessible(true);

            empNo.set(o,"we");
            empName.set(o,"wdwe");
            empPost.set(o,"wedwe");
            empSalary.set(o,3243);

            Method showInfo=clz.getDeclaredMethod("showInfo");
            showInfo.invoke(o);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
